local dianhua = fk.CreateSkill {

  name = "joy__dianhua",

  tags = {  },

}



dianhua:addEffect(fk.EventPhaseStart, {
  name = "joy__dianhua",
  anim_type = "control",
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(dianhua.name) and (player.phase == Player.Start or player.phase == Player.Finish)
  end,
  on_cost = function(self, event, target, player, data)
    local n = 1
    for _, suit in ipairs({"spade", "club", "heart", "diamond"}) do
      if player:getMark("@@falu"..suit) > 0 then
        n = n + 1
      end
    end
    if player.room:askForSkillInvoke(player, dianhua.name) then
      event:setCostData(self, n)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:askForGuanxing(player, room:getNCards(event:getCostData(self)), nil, {0, 0}, dianhua.name)
  end,
})

return dianhua